Skip to content

[PM-31128] Add reinit_user_crypto for mobile#1148

Merged
Thomas-Avery merged 8 commits into
mainfrom
km/pm-31128
Jun 10, 2026
Merged

[PM-31128] Add reinit_user_crypto for mobile#1148
Thomas-Avery merged 8 commits into
mainfrom
km/pm-31128

Conversation

@Thomas-Avery

@Thomas-Avery Thomas-Avery commented May 28, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-31128

📔 Objective

Add functionality to CryptoClient to allow mobile applications that receive a new accountCryptographicState and V2UpgradeToken from a userKey rotation upgrade sync to be able to reinit SDK's cryptography state.

@Thomas-Avery Thomas-Avery self-assigned this May 28, 2026
@github-actions

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

🔍 SDK Breaking Change Detection

SDK Version: km/pm-31128 (74929db)

⚠️ If breaking changes are detected, a corresponding pull request addressing them must be ready for merge in the affected client repository.

Client Status Details
typescript ✅ No breaking changes detected Compilation passed with new SDK version - View Details
android ✅ No breaking changes detected Compilation passed with new SDK version - View Details

Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm.
Results update as workflows complete.

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.62500% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.77%. Comparing base (5bdc976) to head (e1b9f26).

Files with missing lines Patch % Lines
...bitwarden-core/src/key_management/crypto_client.rs 0.00% 6 Missing ⚠️
...re/src/key_management/crypto/reinit_user_crypto.rs 98.36% 5 Missing ⚠️
crates/bitwarden-uniffi/src/crypto.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1148      +/-   ##
==========================================
+ Coverage   84.71%   84.77%   +0.05%     
==========================================
  Files         448      449       +1     
  Lines       60343    60658     +315     
==========================================
+ Hits        51122    51424     +302     
- Misses       9221     9234      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +297 to +303
// The key store should not already have any keys initialized
if ctx.has_symmetric_key(SymmetricKeySlotId::User)
|| ctx.has_private_key(PrivateKeySlotId::UserPrivateKey)
|| ctx.has_signing_key(SigningKeySlotId::UserSigningKey)
{
return Err(EncryptionSettingsError::CryptoInitialization);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this check upstream seem like the best approach. Open to other suggestions.

@Thomas-Avery Thomas-Avery marked this pull request as ready for review May 29, 2026 17:13
@Thomas-Avery Thomas-Avery requested review from a team as code owners May 29, 2026 17:13
@Thomas-Avery Thomas-Avery requested review from coroiu and quexten May 29, 2026 17:13

@quexten quexten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few smaller nits, but more importantly the PIN migration is missing.

Comment thread crates/bitwarden-core/src/key_management/crypto/reinit_user_crypto.rs Outdated
Comment thread crates/bitwarden-core/src/key_management/crypto/reinit_user_crypto.rs Outdated
Comment thread crates/bitwarden-core/src/key_management/crypto/reinit_user_crypto.rs Outdated
@Thomas-Avery Thomas-Avery requested a review from quexten June 1, 2026 20:52

@coroiu coroiu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping me when this is ready for merge :)

quexten
quexten previously approved these changes Jun 2, 2026
quexten
quexten previously approved these changes Jun 4, 2026
@Thomas-Avery Thomas-Avery requested a review from coroiu June 9, 2026 16:08
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@Thomas-Avery Thomas-Avery merged commit 9eb8c6e into main Jun 10, 2026
70 checks passed
@Thomas-Avery Thomas-Avery deleted the km/pm-31128 branch June 10, 2026 14:12
bw-ghapp Bot added a commit to bitwarden/sdk-swift that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants